package com.fileupload
import com.lucastex.grails.fileuploader.UFile

class PictureUploadController {
    def index = {
        session["menupage"] = 3
        log.debug "Uploaded file with id=${params.ufileId}"
        [p:PictureUpload,files: UFile.findAllByExtensionOrExtension("jpg","gif"), params:params]
    }
    
    def upload = {
        
    }
    
//    def createPictureUpload = {// for save data of file parallel with Ufile
//        def PictureUploadInstance = new PictureUpload()
//        //PictureUploadInstance.id = params.ufileId
//        PictureUploadInstance.filename = "filename+++"
//        PictureUploadInstance.save()
//        //return [disease_GroupInstance: disease_GroupInstance]
//        redirect(action:index ,params:params)
//    }

    def delete = {
        def ufile = UFile.get(params.id)
        ufile.delete()
        redirect action:index
    }
    def pictureshow = {
        def ufile = UFile.get(params.id)
        [f:ufile]
    }
}
